import time
import unittest
from Page.Page import Page1
from Page.Page2 import Page2
from selenium import webdriver
import yaml,logging
from ddt import ddt,file_data

@ddt()
class Testjiuxian(unittest.TestCase):

    def setUp(self)->None:
        self.driver=webdriver.Chrome()
        self.driver.maximize_window()

    def tearDown(self)->None:
        time.sleep(3)
        self.driver.quit()

    @file_data(r'D:\gao1\PythonProject4\Poyk_0905\yamljiuxian.yaml')

    def test_login_01(self,username,password):
        logging.info('---------start case-----------')
        po=Page1(self.driver)
        # po.luoji_jiuxian_login(username=username,password=password)
        po.open_url('https://www.jiuxian.com/')
        time.sleep(5)
        po.login()
        po.username(username)
        # time.sleep(8)
        # po.dy()
        # assert "账号登录" == po.dy()
        po.password(password)
        time.sleep(15)
        po.loginan()
        logging.info('---------start case-----------')

    def test_login_02(self):
        po = Page2(self.driver)
        po.open_url('https://www.jiuxian.com/')
        po.luoji_jiuxian_sousuo()